﻿<UserControl x:Class="WpfImageDuplicates.TopCommandBar"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:y="clr-namespace:WpfImageDuplicates"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d">
    <Grid Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ToolBarTray Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Center">
            <ToolBar Band="1" BandIndex="1" Padding="0,0,0,0" FontSize="9">
                <Button x:Name="btnSetThumbWidthHeight" Content="Thumbnail Size" Click="btnSetThumbWidthHeight_Click"/>
                <Popup x:Name="popup" AllowsTransparency="True" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Border BorderBrush="DarkCyan" BorderThickness="1,1,1,1" Background="White" x:Name="border1"  HorizontalAlignment="Left" VerticalAlignment="Top">
                        <y:WidthHeightControl Margin="6,8,6,6" Width="Auto" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="thumbWidthHeight" ChangeSize="widthHeight_ChangeSize" FontSize="10"/>
                    </Border>
                </Popup>
                <Separator />
                <Button x:Name="btnRemoveDuplicates" Command="{x:Static y:Commands.RemoveDuplicatesCommand}" Focusable="False" Content="Remove Duplicates" />
                <Separator />
                <Button x:Name="btnCompareMultiple" Command="{x:Static y:Commands.WantCompareMultipleCommand}" Content="Compare Multiple" ToolTip="View and Compare all selected images"/>
                <Separator />
                <Button x:Name="btnViewStats" Command="{x:Static y:Commands.ViewStatsCommand}" Focusable="False" Content="Stats" />
                <Separator />
                <Button x:Name="btnViewSettings" Command="{x:Static y:Commands.ViewSettingsCommand}" Focusable="False" Content="Settings" />
                <Separator />
                <Button x:Name="btnBlur" Command="{x:Static y:Commands.WantBlurCommand}" Focusable="False" Content="Calculate Blurs" />
                <Separator />
                <Button x:Name="btnRefreshThumbs" Command="{x:Static y:Commands.WantRefreshThumbsCommand}" Focusable="False" Content="Refresh" />
                <Separator />
                <Button x:Name="btnViewExplorer" Command="{x:Static y:Commands.ViewFolderExplorerCommand}" Focusable="False" Content="Folders" />
                <Separator />
                <Button x:Name="btnSelectSort" Content="Sorting" Click="btnSelectSort_Click"/>
                <Popup x:Name="sortPopup" AllowsTransparency="True" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Border BorderBrush="DarkCyan" BorderThickness="1,1,1,1" Background="White" x:Name="border2"  HorizontalAlignment="Left" VerticalAlignment="Top">
                        <y:SelectSortControl x:Name="selectSort" Margin="6,8,6,6" VerticalAlignment="Center" FontSize="10" SettingsViewModel="{Binding}"/>
                    </Border>
                </Popup>
                <Separator />
                <Button x:Name="btnFilter" Click="btnFilter_Click">
                    <Button.Content>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="Filter"/>
                            <TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Mode=OneWay, Path=FileNameFilter, StringFormat=' ({0})'}"/>
                        </Grid>
                    </Button.Content>
                </Button>
                <Popup x:Name="filterPopup" AllowsTransparency="True" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Border BorderBrush="DarkCyan" BorderThickness="1,1,1,1" Background="White" x:Name="border3" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <y:FileNameFilterControl Margin="6,8,6,6" x:Name="fileNameFilter" VerticalAlignment="Center" SettingsViewModel="{Binding}" FontSize="10"
                                                 RequestDone="fileNameFilter_RequestDone"/>
                    </Border>
                </Popup>
                <Separator />
                <TextBlock Text=" Images: " VerticalAlignment="Center" HorizontalAlignment="Right" />
                <TextBlock x:Name="listTotal" Canvas.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Center"/>

                <Grid Margin="0" Visibility="Collapsed" >
                    <TextBlock Text=" Selected: " VerticalAlignment="Center" HorizontalAlignment="Right" />
                    <TextBlock x:Name="listSelected" Canvas.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Center" />
                    <TextBlock Text="/" VerticalAlignment="Center" HorizontalAlignment="Right" />
                    <TextBlock x:Name="listItemCount" Canvas.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                </Grid>
                <Button FontSize="9" Content="X" Padding="2,0,2,0" ToolTip="Close the Top Command Bar" x:Name="btnClose" Click="btnClose_Click"/>
            </ToolBar>
        </ToolBarTray>
    </Grid>
</UserControl>
